home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / MOUSLIB6.ARJ / MOUSETST.PAS < prev    next >
Pascal/Delphi Source File  |  1992-02-01  |  2KB  |  59 lines

  1. (******************************************************************************
  2. *                                  mouseTest                                  *
  3. * This is a simple test program that shows if the mouse is functions, and                    *
  4. * demonstrates basic mouse programming using the mouseLib unit.                        *
  5. ******************************************************************************)
  6. program mouseTest;
  7.  
  8. uses 
  9.    mouseLib
  10.    ,Crt
  11.    ,Graph
  12.    ;
  13.  
  14. var 
  15.    grdriver,
  16.    grmode : integer;
  17.  
  18. begin
  19.      clrScr;
  20.      if not (mouse_present) then begin
  21.      { mouse_present was set by the mouseLib initialization code .. }
  22.           write('mouse not installed');
  23.           exit;
  24.      end;
  25.      case mouse_buttons of
  26.           twoButton : writeLn('MicroSoft mouse Mode');
  27.           threeButton : writeLn('PC mouse Mode');
  28.           else writeLn('UnRecognized mouse mode');
  29.      end; {case}
  30.      writeln('MouseLib demo program, (c) 1992, Ron Loewy.');
  31.      writeln;
  32.      writeln('Move Cursor, Press Right & Left buttons together to continue');
  33.      writeln('             Press any mouse button by itself to recognize');
  34.      window(10, 7, 70, 20);
  35.      hardwareTextCursor(10,13); { "normal" text cursor }
  36.      showMouseCursor; { display the cursor }
  37.      repeat
  38.            if getButton(leftButton) = buttonDown then
  39.               writeLn('Left Button Pressed');
  40.            if getButton(rightButton) = buttonDown then
  41.               writeLn('right Button Pressed');
  42.            if getButton(middleButton) = buttonDown then
  43.               writeLn('Middle Button Pressed');
  44.      until (getButton(leftButton) = buttonDown) and
  45.            (getButton(RightButton) = buttonDown);
  46.      hideMouseCursor; { we hide the cursor }
  47.      grDriver := detect;
  48.      initGraph(grDriver, grMode, '');
  49.      setMouseGraph; { fix quircks in Herc. graphic card }
  50.      initMouse; { let the mouse sense it is in graphic mode }
  51.      outTextXY(10, 10, 'MouseLib demo program, (c) 1992, Ron Loewy.');
  52.      outTextXY(10, 30, 'Press the Middle Button to END');
  53.      showMouseCursor; { draw the graphic default arrow cursor }
  54.      repeat until getButton(middleButton) = buttonDown;
  55.      hideMouseCursor;
  56.      closeGraph;
  57. end.
  58. 
  59.